package io.webchat.config;

import com.github.pagehelper.PageInterceptor;
import com.github.pagehelper.autoconfigure.PageHelperProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @className: PageInterceptorConfig
 * @description:
 * @author: lijinping
 * @date: 2021/6/28
 **/

@EnableConfigurationProperties(PageHelperProperties.class)
@Configuration
public class PageInterceptorConfig {

    @Autowired
    private PageHelperProperties properties;

    @Bean
    public PageInterceptor pageInterceptor() {
        PageInterceptor pageInterceptor = new PageInterceptor();
        pageInterceptor.setProperties(properties.getProperties());
        return pageInterceptor;
    }
}
